package com.njcs.test;

public class CompareNumber {
	public int getMaxValueWidthoutBoolean(int a, int b) {
		int[] array = new int[a];
		try {
			// 只要b比a大，数组越界，肯定会导致异常，否则b比a小
			// 所以在catch模块中返回b，非异常返回a即可
			array[b] = 0;
		} catch (Exception ex) {
			return b;
//			throw new RuntimeException();
		}
		return a;
	}

	public static void main(String[] args) {
		System.out
				.println(new CompareNumber().getMaxValueWidthoutBoolean(2, 5));
	}

}
